<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // string 转数值
      // var a = '100'
      // var b = Number(a)
      // console.log(typeof a, typeof b)

      // boolean 转数值
      // var a = true
      // var b = Number(a)
      // console.log(a, b) //true 1,false 0

      // null 转数值
      // var a = null
      // var b = Number(a)
      // console.log(a, b) // null,0

      // undefined 转数值
      var a = undefined
      var b = Number(a)
      console.log(a, b) // NAN 也是数据类型
    </script>
  </body>
</html>
